﻿using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System.ComponentModel;
using System.Drawing;

namespace Pangeo.Admin.Models.HrmDb.Dto
{
    /// <summary>
    /// 排班
    /// </summary>
    public class TmWorkPlanPeoples
    {
        /// <summary>
        /// 排班ID
        /// </summary>
        [Description("排班ID")]
        [BsonId]
        public ObjectId _id { get; set; }

        /// <summary>
        /// 工号
        /// </summary>
        [Description("工号")]
        public string people_no { get; set; }

        public string ou_code { get; set; }

        public string ou_name { get; set; }

        /// <summary>
        /// 姓名
        /// </summary>
        [Description("姓名")]
        public string people_name { get; set; }

        /// <summary>
        /// 会计科目
        /// </summary>
        [Description("会计科目")]
        public string ledger_account { get; set; }

        /// <summary>
        /// 人员类别
        /// </summary>
        [Description("人员类别")]
        public string people_category { get; set; }

        /// <summary>
        /// 是否研发人员
        /// </summary>
        [Description("是否研发人员")]
        public string is_researcher { get; set; }

        /// <summary>
        /// 排班日期
        /// </summary>
        [Format("yyyy-MM-dd")]
        [Description("排班日期")]
        public DateTime date { get; set; }

        /// <summary>
        /// 工作日
        /// </summary>
        [Description("工作日")]
        public bool is_job_day { get; set; }

        /// <summary>
        /// 节假日
        /// </summary>
        [Description("节假日")]
        public bool is_holiday_day { get; set; }

        /// <summary>
        /// 工作日调休
        /// </summary>
        //[Description("工作日调休")]
        //public bool is_ax_day { get; set; }

        /// <summary>
        /// 休息日调休
        /// </summary>
        //[Description("休息日调休")]
        //public bool is_exchange_off_day { get; set; }

        /// <summary>
        /// 是否跨天
        /// </summary>
        [Description("是否跨天")]
        public bool is_cross_day { get; set; }

        /// <summary>
        /// 班次
        /// </summary>
        [Description("班次")]
        public string name { get; set; }

        /// <summary>
        /// 班次开始时间
        /// </summary>
        [Format("HH:mm")]
        [Description("班次开始时间")]
        public DateTime start { get; set; }

        /// <summary>
        /// 班次结束时间
        /// </summary>
        [Format("HH:mm")]
        [Description("班次结束时间")]
        public DateTime end { get; set; }

        /// <summary>
        /// 工作时长（分钟）
        /// </summary>
        public int work_mins { get; set; }

        /// <summary>
        /// 休息时长(分钟)
        /// </summary>
        public int break_mins { get; set; }

        /// <summary>
        /// 休息开始时间1
        /// </summary>
        [Format("HH:mm")]
        [Description("休息开始时间1")]
        public DateTime? break_start { get; set; }

        /// <summary>
        /// 休息结束时间1
        /// </summary>
        [Format("HH:mm")]
        [Description("休息结束时间1")]
        public DateTime? break_end { get; set; }

        /// <summary>
        /// 休息开始时间2
        /// </summary>
        [Format("HH:mm")]
        [Description("休息开始时间2")]
        public DateTime? break_start2 { get; set; }

        /// <summary>
        /// 休息结束时间1
        /// </summary>
        [Format("HH:mm")]
        [Description("休息结束时间2")]
        public DateTime? break_end2 { get; set; }

        #region 添加的字段

        /// <summary>
        /// 排班日期
        /// </summary>
        /*[Description("排班日期")]
        public string job_date { get; set; }

        /// <summary>
        /// 班次开始时间
        /// </summary>
        [Description("班次开始时间")]
        public string start_time { get; set; }

        /// <summary>
        /// 班次结束时间
        /// </summary>
        [Description("班次结束时间")]
        public string end_time { get; set; }*/

        /// <summary>
        /// 工作时长（小时）
        /// </summary>
        [Format("#.#")]
        [Description("工作时长")]
        public double work_hours { get; set; }

        /// <summary>
        /// 休息时长(小时)
        /// </summary>
        [Format("#.##")]
        [Description("休息时长")]
        public decimal break_hours { get; set; }

        /// <summary>
        /// 上班打卡时间
        /// </summary>
        [Format("yyyy-MM-dd HH:mm:ss")]
        [Description("上班打卡时间")]
        public DateTime? first_clock { get; set; }

        /// <summary>
        /// 下班打卡时间
        /// </summary>
        [Format("yyyy-MM-dd HH:mm:ss")]
        [Description("下班打卡时间")]
        public DateTime? last_clock { get; set; }

        /// <summary>
        /// 加班开始时间
        /// </summary>
        public DateTime? work_on_time { get; set; }

        /// <summary>
        /// 加班开始时间（导出会用到）
        /// </summary>
        [Description("加班开始时间")]
        public string _work_on_time
        {
            get
            {
                if (work_on_time.HasValue)
                    return work_on_time.Value.ToString("yyyy-MM-dd HH:mm");
                else
                    return string.Empty;
            }
        }

        /// <summary>
        /// 加班结束时间
        /// </summary>
        public DateTime? work_off_time { get; set; }

        /// <summary>
        /// 加班结束时间（导出会用到）
        /// </summary>
        [Description("加班结束时间")]
        public string _work_off_time
        {
            get
            {
                if (work_off_time.HasValue)
                    return work_off_time.Value.ToString("yyyy-MM-dd HH:mm");
                else
                    return string.Empty;
            }
        }

        /// <summary>
        /// 加班时长
        /// </summary>
        [Description("加班时长")]
        public double total_hours { get; set; }

        /// <summary>
        /// 请假时长
        /// </summary>
        [Description("请假时长")]
        public double leave_hours { get; set; }

        /// <summary>
        /// 夜班时长
        /// </summary>
        [Description("夜班时长")]
        public double night_hours { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        //[Description("状态")]
        public string conclusion { get; set; }

        public Color? bgColor { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [Description("备注")]
        public string remark { get; set; }

        #endregion
    }
}
